/**
 * Project Name:emm-basic
 * File Name:BusinessChangeServiceImpl.java
 * Package Name:com.emm.yixun.basic.service.impl
 * Date:2017年11月13日上午11:00:21
 * Copyright (c) 2017, shihao.liu@qiaofang.info All Rights Reserved.
 *
*/

package com.emm.yixun.basic.service.impl;
import java.util.List;

import com.emm.yixun.basic.mapper.BusinessReceiveRefundMapper;
import com.emm.yixun.basic.mapper.PaymentStagesMapper;
import com.emm.yixun.common.model.BusinessReceiveRefund;
import com.emm.yixun.common.model.PaymentStages;
import com.emm.yixun.common.model.dto.BusinessReceiveRefundDto;
import com.emm.yixun.common.model.dto.PaymentStagesDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.emm.yixun.basic.mapper.BusinessChangeMapper;
import com.emm.yixun.basic.service.BusinessChangeService;
import com.emm.yixun.common.model.BusinessChange;
import com.emm.yixun.common.model.dto.BusinessChangeDto;
import com.emm.yixun.common.page.Page;

/**
 * ClassName:BusinessChangeServiceImpl <br/>
 * Date:     2017年11月13日 上午11:00:21 <br/>
 * @author   Administrator
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
@Service("businessChangeService")
public class BusinessChangeServiceImpl implements BusinessChangeService {

	@Autowired
	private BusinessChangeMapper businessChangeMapper;

	@Autowired
	private BusinessReceiveRefundMapper businessReceiveRefundMapper;

	@Autowired
	private PaymentStagesMapper paymentStagesMapper;

	public Page<BusinessChange> getModelByPage(BusinessChangeDto businessChangeDto,int begin,int end) {
		 Integer count = businessChangeMapper.queryBusinessChangeInfoCount(businessChangeDto);
		 if(businessChangeDto.isExport()){
			 end = count;
			 begin = 0;
		 }
		 List<BusinessChange> row = businessChangeMapper.queryBusinessChangeInfo(businessChangeDto,begin,end);
		 Page<BusinessChange> page = new Page<BusinessChange>(count, row);
		 page.setPageSize(end);
		 return page;
	}
	public Page<BusinessReceiveRefund> getModelByPageNew(BusinessReceiveRefundDto businessReceiveRefundDto, int begin, int end) {
		Integer count = businessReceiveRefundMapper.queryBusinessChangeInfoCount(businessReceiveRefundDto);
		if(businessReceiveRefundDto.isExport()){
			end = count;
			begin = 0;
		}
		List<BusinessReceiveRefund> row = businessReceiveRefundMapper.queryBusinessChangeInfo(businessReceiveRefundDto,begin,end);
		Page<BusinessReceiveRefund> page = new Page<BusinessReceiveRefund>(count, row);
		page.setPageSize(end);
		return page;
	}

	public Page<BusinessReceiveRefund> getModelOutByPageNew(BusinessReceiveRefundDto businessReceiveRefundDto, int begin, int end){
		Integer count = businessReceiveRefundMapper.queryBusinessOutInfoCount(businessReceiveRefundDto);
		if(businessReceiveRefundDto.isExport()){
			end = count;
			begin = 0;
		}
		List<BusinessReceiveRefund> row = businessReceiveRefundMapper.queryBusinessOutInfo(businessReceiveRefundDto,begin,end);
		Page<BusinessReceiveRefund> page = new Page<BusinessReceiveRefund>(count, row);
		page.setPageSize(end);
		return page;
	}

	public Page<PaymentStages> queryPaymentStagesBaseInfo(PaymentStagesDto paymentStagesDto, int begin, int end) {
		Integer count = paymentStagesMapper.queryPaymentStagesBaseInfoCount(paymentStagesDto);
		if(paymentStagesDto.isExport()){
			end = count;
			begin = 0;
		}
		List<PaymentStages> row = paymentStagesMapper.queryPaymentStagesBaseInfo(paymentStagesDto,begin,end);
		Page<PaymentStages> page = new Page<PaymentStages>(count, row);
		page.setPageSize(end);
		return page;
	}

	public List<PaymentStages> queryPaymentStagesDetail(List<String> list) {
		return paymentStagesMapper.queryPaymentStagesDetail(list);
	}

	public Page<PaymentStages> queryAuditAccountInfo(PaymentStagesDto paymentStagesDto, int begin, int end) {
		Integer count = paymentStagesMapper.queryAuditAccountInfoCount(paymentStagesDto);
		if(paymentStagesDto.isExport()){
			end = count;
			begin = 0;
		}
		List<PaymentStages> row = paymentStagesMapper.queryAuditAccountInfo(paymentStagesDto,begin,end);
		Page<PaymentStages> page = new Page<PaymentStages>(count, row);
		page.setPageSize(end);
		return page;
	}

	public Page<PaymentStages> queryContractDiffInfo(PaymentStagesDto paymentStagesDto, int begin, int end) {
		Integer count = paymentStagesMapper.queryContractDiffInfoCount(paymentStagesDto);
		if(paymentStagesDto.isExport()){
			end = count;
			begin = 0;
		}
		List<PaymentStages> row = paymentStagesMapper.queryContractDiffInfo(paymentStagesDto,begin,end);
		Page<PaymentStages> page = new Page<PaymentStages>(count, row);
		page.setPageSize(end);
		return page;
	}

	public List<PaymentStages> queryPaymentStagesAdvanceNeed(List<String> list){
		return paymentStagesMapper.queryAdvanceNeed(list);
	}

	public List<PaymentStages> queryPaymentStagesAdvanceHave(List<String> list){
		return paymentStagesMapper.queryAdvanceHave(list);
	}
}

